home *** CD-ROM | disk | FTP | other *** search
- To: brave users
- From: George Byrkit
- 1809 Saxon St
- Ann Arbor, MI 48103
- 313-663-1009
- Date: 13 October 1993
-
- I thought I'd post this piece of code for you all to use, if you so wish.
- There is no support, but I'd like to know about bugs you find.
-
- This code (inifile.cpp, inifile.h), implements the GetProfileString,
- GetProfileInt, WriteProfileString, GetPrivateProfileString, GetPrivateProfileInt
- and WritePrivateProfileString functions for use with DOS programs.
-
- The non-private versions of the function look in the current directory to find
- the file 'win.ini'. I'm not about to hunt for where windows is installed. I
- would suggest using the private version and passing in the actual location, if
- you need it.
-
- I've also included a simple program, editini.cpp, that makes use of the
- functions in inifile.cpp.
-
- Please note that inifile.h is taken from a relavent section in windows.h, early
- on, where we get the datatypes needed, and actually use the definitions of
- the above functions that exist there. This causes us to be compatible with the
- Windows API functions at the calling protocol level.
-
- Although this particular coding was created and tested with BC/C++ 3.1, I
- believe it should port well to other compilers.
-
- Warning:
- Assume the ini file name is foo.ini for the discussion of file names below.
- The technique used to write a new value is to read the original file, and create
- a copy that has the new value. The original file is then renamed to a temporary
- name. (original file name (s.b. *.ini) changed to foo.i$$). The copy file is
- usually named 'foo.in$'. The copy file is then renames to foo.ini. The renamed
- original file is then deleted. If anything goes wrong, a best effort is done to
- restore the original ini file.
-